<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    {include file="../tpl/header.html" /}
</head>
<script type="text/javascript" src="{$conf['static_url']}/admin/js/xcity.js?{$PUBCJ}"></script>
<body>
{include file="../tpl/menu.html" /}
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form" method="post" action="{:url('admin/admin/regionAddExample')}">

            <div class="layui-form-item x-city" id="area_info">
                <label class="layui-form-label">场所地区</label>
                <div class="layui-input-inline">
                    <select name="province" lay-filter="province">
                        <option value="">请选择省</option>
                    </select>
                </div>
                <div class="layui-input-inline">
                    <select name="city" lay-filter="city">
                        <option value="">请选择市</option>
                    </select>
                </div>
                <div class="layui-input-inline">
                    <select name="area" lay-filter="area">
                        <option value="">请选择县/区</option>
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"></label>
                <button class="layui-btn" lay-filter="add" lay-submit="">增加</button>
            </div>
        </form>
    </div>
</div>
<script>

    layui.use(['form','code'], function(){
        form = layui.form;
        layui.code();
        $('#area_info').xcity();
    });

    layui.use(['form', 'layer'],
        function() {
            $ = layui.jquery;
            var form = layui.form, layer = layui.layer;
            //监听提交
            form.on('submit(add)', function(data) {
                $.ajax({
                    type:'post',
                    data:data.field,
                    dataType:'json',
                    url:"{:url('admin/admin/regionAddExample')}",
                    success:function (e) {
                        if(e.code === 1){
                            layer.msg(e.msg, {icon: 6,time: 3000});
                        }else{
                            layer.msg(e.msg, {icon: 5,time: layer_msg_error_time});
                        }
                    }
                });
                //发异步，把数据提交给php
                return false;
            });
        });
</script>
</body>
</html>